package cn.kevinking.ai.mcp.provider.heartbeat;

import cn.kevinking.ai.common.model.ResultVO;
import cn.kevinking.ai.common.model.ServerInfo;
import cn.kevinking.ai.mcp.provider.service.NamingService;
import lombok.AllArgsConstructor;

/**
 * @author kevinking
 */
@AllArgsConstructor
public class BeatTask implements Runnable {
    private final BeatInfo beatInfo;
    private final NamingService serverProxy;

    @Override
    public void run() {
        if (beatInfo.isStopped()) {
            return;
        }
        change2RunIfReady();
        ResultVO<Object> sendResult = serverProxy.sendBeat(, beatInfo);
    }

    private void change2RunIfReady() {
        if (beatInfo.isReady()) {
            beatInfo.setStatus(BeatStatus.RUNNING);
        }
    }
}
